package proto

type ErrorCode struct {
	Code    int
	Message string
}

var (
	Success        = ErrorCode{Code: 200, Message: "success"}
	ParameterError = ErrorCode{Code: 500101, Message: "参数错误"}
	AddTaskError   = ErrorCode{Code: 100101, Message: "添加任务前请先删除正在执行的任务"}
)

//nolint:unused
func GetMessage(code int) string {
	switch code {
	case Success.Code:
		return Success.Message
	case ParameterError.Code:
		return ParameterError.Message
	default:
		return "unknown error"
	}
}
